from rest_framework.serializers import ModelSerializer

from home.models import NavModel, BannerModel, CateModel


class NavSer(ModelSerializer):
    class Meta:
        model = NavModel
        fields = '__all__'


class BannerSer(ModelSerializer):
    class Meta:
        model = BannerModel
        fields = '__all__'


class CateSer(ModelSerializer):
    class Meta:
        model = CateModel
        fields = ['id', 'catename']


class CategorySer(ModelSerializer):
    children = CateSer(many=True)

    class Meta:
        model = CateModel
        fields = '__all__'
